# 将标签图从json文件中批量取出
import os
import shutil

path = r'/dssg/home/zhineng_qt/test_2021_3_18_fu/dataset/car1000_2/car1000/'
pathlabels = r'/dssg/home/zhineng_qt/test_2021_3_18_fu/dataset/car1000_2/car1000/labels/'
dirpath = r'/dssg/home/zhineng_qt/test_2021_3_18_fu/dataset/car1000_2/car1000/images/'

# for eachfile in os.listdir(path):
#     if os.path.isdir(path + eachfile):
#         if os.path.exists(path + eachfile + '/label.png'):
#             shutil.copy(path + eachfile + '/label.png', dirpath + eachfile.split('_')[0] + '.png')
#             print(eachfile + ' successfully moved')
#

# for eachfile in os.listdir(pathlabels):
#     # if os.path.isdir(path + eachfile):
#     #     if os.path.exists(path + eachfile + '/label.png'):
#     #         shutil.copy(path + eachfile + '/label.png', dirpath + eachfile.split('_')[0] + '.png')
#     #         print(eachfile + ' successfully moved')
#     print(eachfile)
